package com.custom.jdbc.executebody;

import java.lang.reflect.Field;
import java.util.List;

/**
 * @author Xiao-Bai
 * @since 2023/3/15 17:46
 */
public class ExecuteBodyHelper {

    public static BaseSqlExecutorBody createSelect(Class<?> t, String sql, Object... params) {
        return new BaseSqlExecutorBody(t, sql, true, params);
    }

    public static BaseSqlExecutorBody createSelectIf(Class<?> t,  String sql, boolean b, Object... params) {
        return new BaseSqlExecutorBody(t, sql, b, params);
    }

    public static SelectMapExecutorBody createSelectMap(Class<?> kClass, Class<?> vClass, String sql, boolean b, Object... params) {
        return new SelectMapExecutorBody(sql, b, params, kClass, vClass);
    }

    public static BaseSqlExecutorBody createExecUpdate(String sql, Object... params) {
        return new BaseSqlExecutorBody(sql, true, params);
    }

    public static BaseSqlExecutorBody createExecUpdate(String sql, boolean b, Object... params) {
        return new BaseSqlExecutorBody(sql, b, params);
    }

    public static <T> InsertExecutorBody<T> createSave(List<T> list, Class<T> mappedType, Field keyField, String sql, boolean b, Object... params) {
        return new InsertExecutorBody<>(list, mappedType, keyField, sql, b, params);
    }

    public static BaseSqlExecutorBody createExecAnySql(String sql, boolean b) {
        return new BaseSqlExecutorBody(sql, b, null);
    }


}
